local cihuang = fk.CreateSkill{
    name = "va_heg__cihuang",
}

Fk:loadTranslationTable{
    ["va_heg__cihuang"] = "雌黄",
    [":va_heg__cihuang"] = "出牌阶段限一次，你可以选择一名其他角色进行拼点，若你赢，则你视为对其使用一张基本牌或普通锦囊牌。"..
    "<a href='heg__zongheng'><b>纵横<b></a>：删去〖雌黄〗描述中的普通锦囊牌。",

    ["#va_heg__cihuang"] = "雌黄：你可以选择一名其他角色进行拼点",
    ["#va_heg__cihuang_use" ] = "雌黄：你可以视为对%dest使用一张基本牌或普通锦囊牌",
    ["@@va_heg__cihuang_manoeuvre"] = "雌黄 纵横",
    ["va_heg__cihuang_mn_ask"] = "令%dest获得〖雌黄（纵横）〗直到其下回合结束。",

    ["$va_heg__cihuang1"] = "腹存经典，口吐雌黄。",
    ["$va_heg__cihuang2"] = "手把玉麈，胸蕴成篇。",
}

local U = require "packages/utility/utility"

cihuang:addEffect("active",{
    anim_type = "special",
    prompt = "#va_heg__cihuang",
    can_use = function (self, player)
        return player:usedSkillTimes(cihuang.name, Player.HistoryPhase) == 0 and not player:isKongcheng()
    end,
    card_num = 0,
    target_num = 1,
    card_filter = Util.FalseFunc,
    target_filter = function (self, player, to_select, selected)
        return #selected == 0 and to_select ~= player and not to_select:isKongcheng()
    end,
    on_use = function (self, room, effect)
        local player = effect.from
        local target = effect.tos[1]
        local pindian = player:pindian({target}, cihuang.name)
        if player.dead or target.dead then return end
        if pindian.results[target].winner == player then
            local all_names = Fk:getAllCardNames("bt", false)
            local names = {}
            for _, n in ipairs(all_names) do
                local card = Fk:cloneCard(n)
                if player:canUseTo(card, target) then
                    table.insert(names, n)
                end
            end
        if #names == 0 then return end
        local name = U.askForChooseCardNames(room, player, names, 1, 1, cihuang.name, "#va_heg__cihuang_use::"..target.id, all_names)
        if name then
            room:useVirtualCard(name[1], nil, player, target, cihuang.name, false)
        end
      end
       local choices = {"va_heg__cihuang_mn_ask::" .. target.id, "Cancel"}
       if room:askToChoice(player, {choices = choices, skill_name =  cihuang.name}) ~= "Cancel" then
      room:setPlayerMark(target, "@@va_heg__cihuang_manoeuvre", 1)
      room:handleAddLoseSkills(target, "va_heg__cihuang_manoeuvre", nil)
      end
    end
})

return cihuang